package com.workflow.workflowproject.entity;

import com.alibaba.fastjson2.JSONObject;
import com.alibaba.fastjson2.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.io.Serial;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

/**
 *  实体类。
 *
 * @author Administrator
 * @since 2024-10-28
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table("t_com_flow_field")
public class FlowField implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    /**
     * 字段id
     */
    @Id(keyType = KeyType.Auto)
    private Integer id;

    @Column(value = "field_name")
    @Schema(description = "字段名称")
    private String fieldName;

    @Column(value = "title")
    @Schema(description = "标题")
    private String title;

    @Column(value = "field_json")
    @Schema(description = "字段json")
    private String fieldJson;


    @Column(value = "pc_field_json")
    @Schema(description = "移动端json")
    private JSONObject pcFieldJson;

    @Column(value = "form_id")
    @Schema(description = "表单id")
    private String formId;

    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Column(value = "create_time",onInsertValue = "now()")
    @Schema(description = "创建时间")
    private LocalDateTime createTime;

    /**
     * 修改时间
     */
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Column(value = "update_time",onUpdateValue = "now()")
    @Schema(description = "修改时间")
    private LocalDateTime updateTime;

    @Column(value = "exist",isLogicDelete = true)
    @Schema(description = "是否删除")
    private Integer exist;

}
